<template>
  <div class="subApplicationBox">
    <!-- 因为 vue router的前进，也就是router.go(1) 导致的错误，-->
    <!-- Target container with #container not existed while xxx mounting -->
    <!-- 将子应用容器与 router-view 组件放在同级位置，避免在路由刷新之后，dom 实例重新生成-->
    <!-- 启动子应用依然在该页面启动 -->
    <!-- <div id="sub-container"></div> -->
  </div>
</template>

<script lang="jsx" setup>
import { start } from 'qiankun'
import { onMounted } from 'vue'
import { initRegisterMicroApps } from '@/utils/qiankun/qiankun'

onMounted(() => {
  if (!window.qiankunStarted) {
    window.qiankunStarted = true

    initRegisterMicroApps()
    start()
  }
})
</script>

<style lang="less" scoped>
.subApplicationBox {
  width: 100%;
  height: 100%;

  /deep/ #sub-container {
    width: 100%;
    height: 100%;
    > div {
      width: 100%;
      height: 100%;
    }

    #app {
      width: 100%;
      height: 100%;
    }
  }
}
</style>
